package com.pisolution.actuator.client;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * 从配置文件中读取客户端监控相关配置项并在客户端启动时配置客户端.
 *
 * @author sora
 * @version 0.1.0
 */
@ConfigurationProperties(prefix = "pier.actuator.client")
public class ActuatorClientConfig {
    // -------------------------------------------------------------------------------------------------
    //  配置单元 (基础配置)
    // -------------------------------------------------------------------------------------------------

    /** 是否启用客户端监控. */
    private boolean enabled = true;

    // -------------------------------------------------------------------------------------------------
    //  配置单元 (注册相关)
    // -------------------------------------------------------------------------------------------------

    /** 监控服务端地址. */
    private String url = "";

    /** 接入失败时的重试次数. */
    private int retry = 10;

    // -------------------------------------------------------------------------------------------------
    //  配置单元 (心跳相关)
    // -------------------------------------------------------------------------------------------------

    /** 心跳上传初始延迟时间 (ms). */
    private long delay = 5_000L;

    /** 心跳上传间隔时间 (ms). */
    private long period = 10_000L;

    // -------------------------------------------------------------------------------------------------
    //  配置单元 (连接相关)
    // -------------------------------------------------------------------------------------------------

    /** 连接超时时间. */
    private long connectTimeout = 5_000L;

    /** 读取超时时间. */
    private long readTimeout = 5_000L;

    /** 授权用户名称. */
    private String username = "";

    /** 授权用户密码. */
    private String password = "";

    // -------------------------------------------------------------------------------------------------
    //  属性访问
    // -------------------------------------------------------------------------------------------------

    public boolean isEnabled() {
        return this.enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public String getUrl() {
        return this.url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public int getRetry() {
        return this.retry;
    }

    public void setRetry(int retry) {
        this.retry = retry;
    }

    public long getDelay() {
        return this.delay;
    }

    public void setDelay(long delay) {
        this.delay = delay;
    }

    public long getPeriod() {
        return this.period;
    }

    public void setPeriod(long period) {
        this.period = period;
    }

    public long getConnectTimeout() {
        return this.connectTimeout;
    }

    public void setConnectTimeout(long connectTimeout) {
        this.connectTimeout = connectTimeout;
    }

    public long getReadTimeout() {
        return this.readTimeout;
    }

    public void setReadTimeout(long readTimeout) {
        this.readTimeout = readTimeout;
    }

    public String getUsername() {
        return this.username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
